<template>
    <customNavigationBar title="企业认证信息" />

    <view style="padding: 24rpx">
        <view class="card">
            <view class="item">
                <text>企业名称</text>
                <text>{{ companyInfomation.companyName }}</text>
            </view>
            <view class="item">
                <text>社会信用码</text>
                <text>{{ companyInfomation.socialCreditCode }}</text>
            </view>
            <view class="item">
                <text>营业执照起始日期</text>
                <text>{{ companyInfomation.socialCreditCodeBegin }}</text>
            </view>
            <view class="item">
                <text>营业执照截至日期</text>
                <text>{{ companyInfomation.socialCreditCodeExpires }}</text>
            </view>
            <view class="item">
                <text>法人姓名</text>
                <text>{{ companyInfomation.legalPerson }}</text>
            </view>
            <view class="item">
                <text>法人身份证起始日期</text>
                <text>{{ companyInfomation.legalCertBegin }}</text>
            </view>
            <view class="item">
                <text>法人身份证截至日期</text>
                <text>{{ companyInfomation.legalCertExpires }}</text>
            </view>

            <view class="item">
                <text>审核状态</text>
                <view class="red" v-if="companyInfomation.status === -1" @click="edit">
                    <view class="">资料审核失败</view>

                    <view class="">原因：{{ companyInfomation?.notes }}</view>
                    <view class="">点击重新提交</view>
                </view>
                <text class="blue" v-if="companyInfomation.status === 0">待审核</text>
                <text class="green" v-if="companyInfomation.status === 1">审核通过</text>
            </view>
        </view>
    </view>
</template>

<script setup lang="ts">
import { ref, toRaw } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { userApis } from '@/utils/apis';
import { uploadFile } from '../../utils/request';

const companyInfomation = ref({
    companyName: '',
    socialCreditCode: '',
    socialCreditCodeBegin: '请选择日期',
    socialCreditCodeExpires: '2099-12-31',
    socialCreditUrl: '',
    address: '',
    businessScope: '',
    officeSpaceUrl: '',
    legalPerson: '',
    certNo: '',
    legalCertBegin: '请选择日期',
    legalCertExpires: '请选择日期',
    legalCertBackUrl: '',
    legalCertFrontUrl: '',
    status: 0
});

onLoad(() => {
    getCompanyInfomation();
});

const getCompanyInfomation = async () => {
    let res = await userApis.getCompanyInfo();
    companyInfomation.value = res.data;
};

const edit = () => {
    uni.navigateTo({
        url: '/pages_user/setCompanyDetail/setCompanyDetail'
    });
};
</script>

<style>
page {
    background-color: #f2f4f5;
}
</style>

<style lang="scss" scoped>
.card {
    width: 100%;
    padding: 32rpx;
    background: #ffffff;
    border-radius: 16rpx;

    .item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 40rpx;
        text,
        view {
            display: block;
            font-size: 28rpx;
            color: #333333;
            line-height: 40rpx;
        }

        text:last-child {
            color: #999999;
        }

        .red {
            max-width: 80%;
            color: #ff6842 !important;
            text-align: right;
            view {
                color: #ff6842;
            }
        }
        .blue {
            color: #2c73ff !important;
        }
        .green {
            color: #27c646 !important;
        }
    }
}
</style>
